<template>
  <a-modal
    :maskClosable="false"
    :destroyOnClose="true"
    title="人脉审核"
    centered
    :width="600"
    v-model="visible"
    @ok="handleOk"
  >
    <a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol">
      <a-form-model-item label="审核状态">
        <a-radio-group v-model="form.status">
          <a-radio :value="1">通过</a-radio>
          <a-radio :value="2">拒绝</a-radio>
        </a-radio-group>
      </a-form-model-item>
      <a-form-model-item label="审核备注">
        <a-textarea v-model="form.remark" :rows="4" />
      </a-form-model-item>
    </a-form-model>
  </a-modal>
</template>

<script>
import { InnerReview, OutReview } from '@/api/business/source'
import {} from 'ant-design-vue'
export default {
  data() {
    return {
      visible: false,
      labelCol: { span: 4 },
      wrapperCol: { span: 14 },
      form: {
        id: undefined,
        status: 1,
        remark: undefined,
      },
      dataType: 'inner',
    }
  },
  methods: {
    show(id, dataType) {
      this.form.id = id
      this.form.status = 1
      this.form.remark = undefined

      this.dataType = dataType
      this.visible = true
    },
    async handleOk() {
      let { code, msg } =
        this.dataType === 'inner' ? await InnerReview({ ...this.form }) : await OutReview({ ...this.form })
      this.$message[code === 0 ? 'success' : 'error'](msg)
      if (code === 0) {
        this.$emit('success')
        this.visible = false
      }
    },
  },
}
</script>

<style lang="less" scoped>
</style>